package com.bjsxt;
/**设置名字*/

//继承Thread类，用构造方法直接设置
class SetName01 extends Thread{
    public SetName01(String name){
        super(name);
    }
    @Override
    public void run() {
        System.out.println(this.getName());
    }
}
//实现Runnable接口 ，用SetName（）
class SetName03 implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName());
    }
}
public class SetNameThread02 {
    public static void main(String[] args) {
        SetName01 st = new SetName01("one");
        st.start();
        Thread t = new Thread(new SetName03());
        t.setName("two");
        t.start();
    }
}
